//
//  FontTableViewCell.m
//  Car
//
//  Created by lanou on 15/10/5.
//  Copyright (c) 2015年 朱鸿儒. All rights reserved.
//

#import "FontTableViewCell.h"

@implementation FontTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
        UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 100, 30)];
        lable.text = @"正文字体";
        [self addSubview:lable];
        
        UIButton *big = [UIButton buttonWithType:(UIButtonTypeCustom)];
        big.frame = CGRectMake(kWidth - 90, 0, 30, 30);
        big.tag = 100;
        [big setTitle:@"大" forState:(UIControlStateNormal)];
        big.titleLabel.font = [UIFont systemFontOfSize:20];
        [big setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
        [big addTarget:self action:@selector(buttonClick:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:big];
        
        UIButton *mid = [UIButton buttonWithType:(UIButtonTypeCustom)];
        mid.frame = CGRectMake(kWidth - 60, 0, 30, 30);
        mid.tag = 101;
        [mid setTitle:@"中" forState:(UIControlStateNormal)];
        mid.titleLabel.font = [UIFont systemFontOfSize:16];
        [mid setTitleColor:[UIColor blueColor] forState:(UIControlStateNormal)];
        [mid addTarget:self action:@selector(buttonClick:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:mid];
        
        UIButton *small = [UIButton buttonWithType:(UIButtonTypeCustom)];
        small.frame = CGRectMake(kWidth - 30, 0, 30, 30);
        small.tag = 102;
        [small setTitle:@"小" forState:(UIControlStateNormal)];
        small.titleLabel.font = [UIFont systemFontOfSize:12];
        [small setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
        [small addTarget:self action:@selector(buttonClick:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:small];
        
        UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 40, kWidth, 0.5)];
        line.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:line];
        
    }
    return self;
}
- (void)buttonClick:(UIButton *)button{
    if (button.tag == 100) {
        [button setTitleColor:[UIColor blueColor] forState:(UIControlStateNormal)];
        UIButton *btn1 = (UIButton *)[self viewWithTag:101];
        [btn1 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
        UIButton *btn2 = (UIButton *)[self viewWithTag:102];
        [btn2 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    }
    if (button.tag == 101) {
        [button setTitleColor:[UIColor blueColor] forState:(UIControlStateNormal)];
        UIButton *btn1 = (UIButton *)[self viewWithTag:100];
        [btn1 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
        UIButton *btn2 = (UIButton *)[self viewWithTag:102];
        [btn2 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    }
    if (button.tag == 102) {
        [button setTitleColor:[UIColor blueColor] forState:(UIControlStateNormal)];
        UIButton *btn1 = (UIButton *)[self viewWithTag:100];
        [btn1 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
        UIButton *btn2 = (UIButton *)[self viewWithTag:101];
        [btn2 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    }
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
